package com.diploma.interaction.service.impl;


import com.diploma.interaction.mapper.WxxcxBdxxMapper;
import com.diploma.interaction.model.WxxcxBdxx;
import com.diploma.interaction.model.WxxcxBdxxExample;
import com.diploma.interaction.service.BdxxService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;

@Service
@Slf4j
public class BdxxServiceImpl implements BdxxService {
    @Resource
    WxxcxBdxxMapper bdxxMapper;


    @Override
    public int deleteById(int id) {
        WxxcxBdxxExample bdxxExample=new WxxcxBdxxExample();
        bdxxExample.createCriteria().andBdidEqualTo((short) id);
        return bdxxMapper.deleteByExample(bdxxExample);
    }


    @Override
    public int deleteByTel(String tel) {
        WxxcxBdxxExample bdxxExample=new WxxcxBdxxExample();
        bdxxExample.createCriteria().andNsrlxdhEqualTo(tel);
        return bdxxMapper.deleteByExample(bdxxExample);
    }

    @Override
    public void insertSelective(WxxcxBdxx record) {
        bdxxMapper.insert(record);
    }

    @Override
    public WxxcxBdxx selectByTel(String tel) {
        WxxcxBdxxExample bdxxExample=new WxxcxBdxxExample();
        bdxxExample.createCriteria().andNsrlxdhEqualTo(tel);
        List<WxxcxBdxx> res=bdxxMapper.selectByExample(bdxxExample);
        if(res.size()==0){
            return null;
        }else{
            return res.get(0);
        }

    }

}
